Skip to content

fix: resolve 5 cross-package bugs causing test failures#10

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/job-e2e-tier3-2294-1779438966
Open

fix: resolve 5 cross-package bugs causing test failures#10
stooit wants to merge 1 commit into
mainfrom
quantcode/job-e2e-tier3-2294-1779438966

Conversation

@stooit
Copy link
Copy Markdown
Contributor

@stooit stooit commented May 22, 2026

Summary

Fixes all failing tests across the monorepo by resolving 5 cross-package bugs:

  • Renamed hook import (apps/web/src/lib/api.ts): The file imported useSearchDebounce and useThrottle from @e2e/utils, but the actual exports are useDebounce and useDebouncedValue. Updated imports to use the correct names.
  • DOM environment for UI tests (packages/ui/bunfig.toml): UI component tests use @testing-library/react which requires a DOM. Added happy-dom preload to the bun test config.
  • Button accessibility (packages/ui/src/components/Button/Button.tsx): Icon-only buttons were not passing through the aria-label prop. Fixed the component to spread/forward the aria-label attribute.
  • Date format leading zero (packages/utils/src/format/date.ts): formatDate used dd/MM/yyyy (zero-padded day) but tests expected d/MM/yyyy (no leading zero). Fixed the format string.
  • DataTable stale closure (packages/ui/src/components/DataTable/DataTable.tsx): The sort click handler captured stale state. Fixed by using a functional state updater to always read the latest sort direction.

Verification

All 13 tests pass (bun test). TypeScript compilation clean (only bun:test module errors remain in test files, which is expected and cannot be fixed without modifying test files).

Assumptions

  • The bun:test TypeScript errors are acceptable since they only appear in test files (which are not to be modified) and bun resolves them at runtime.
  • happy-dom was already available in node_modules as a dependency.

- Fix renamed hook import: use useDebounce (actual export) in api.ts
- Add jsdom test environment config for UI package DOM tests
- Pass aria-label prop through in Button component for icon-only buttons
- Fix date format to use day without leading zero (d/MM/yyyy)
- Fix stale closure in DataTable sort handler using functional updater
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant